package com.easyadmin.entity.enums;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @Description: 任务执行结果
 * @auther: 多多洛
 * @date: 14:28 2020/11/21
 * @param:
 * @return:
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum TaskRunResultEnum {
    SUCCESS(1, "成功"), ERROR(0, "失败");

    private Integer result;
    private String description;

    TaskRunResultEnum(int result, String description) {
        this.result = result;
        this.description = description;
    }

    public Integer getResult() {
        return result;
    }

    public String getDescription() {
        return description;
    }

    public static TaskRunResultEnum getByResult(Integer result) {
        for (TaskRunResultEnum at : TaskRunResultEnum.values()) {
            if (at.result.equals(result)) {
                return at;
            }
        }
        return null;
    }
}
